#include <algorithm>
#include <cstdio>
#include <cstring>

const int N = 200010;
int n, m = 256, rk[N], sa[N], tmp[N], buk[N];
char str[N];

inline void sort() {
  for (int i = 0; i <= m; ++i) buk[i] = 0;
  for (int i = 1; i <= n; ++i) ++buk[rk[i]];
  for (int i = 1; i <= m; ++i) buk[i] += buk[i - 1];
  for (int i = n; i; --i) sa[buk[rk[tmp[i]]]--] = tmp[i];
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
  freopen("P4051 [JSOI2007]字符加密.in", "r", stdin);
  freopen("P4051 [JSOI2007]字符加密.out", "w", stdout);
#endif
#endif

  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = 1; i <= n; ++i) {
    str[i + n] = str[i];
  }
  n <<= 1;
  for (int i = 1; i <= n; ++i) {
    rk[i] = str[i], tmp[i] = i;
  }
  sort();
  for (int len = 1, p = 0; p < n; m = p, len <<= 1) {
    p = 0;
    for (int i = n - len + 1; i <= n; ++i) tmp[++p] = i;
    for (int i = 1; i <= n; ++i)
      if (sa[i] > len) tmp[++p] = sa[i] - len;
    sort();
    std::swap(rk, tmp);
    rk[sa[1]] = p = 1;
    for (int i = 2; i <= n; ++i) {
      rk[sa[i]] =
          (tmp[sa[i - 1]] == tmp[sa[i]] && tmp[sa[i - 1] + len] == tmp[sa[i] + len]) ? p : ++p;
    }
  }

  for (int i = 1; i <= n; ++i)
    if (sa[i] <= (n >> 1)) {
      putchar(str[sa[i] + (n >> 1) - 1]);
#ifdef DEBUG
      putchar('\n');
#endif
    }
  return 0;
}